#!/usr/bin/env python

import sys
from os3.dbm.dbmanager import DBManager
from os3.auth import Auth, UserManager

#PLAIN TEXT
u = UserManager ( 'plain_text', 'pwd_plain' )
a = Auth ( 'userman', u )

print a.authenticate ( 'john', 'john' )


#UNIX
a = Auth ( 'unix', 'pwd_unix' )

print a.authenticate ( 'root1', 'wrong_pwd' )
print a.authenticate ( 'root2', 'pippo123' )


#DATABASE
dbm = DBManager ( DBManager.DBM_TYPE_MYSQL )
dbm.set_prefix ( 'wa' )
dbm.connect ( db = 'aspes', user = 'root', host = 'localhost' )
u = UserManager ( 'dbm', dbm, 'wa_user' )

a = Auth ( 'userman', u )

print a.authenticate ( 'testone', 'john' )


